Skip to content

fix(studio): a refused sealed press always puts the box back on the layer - #8735

Merged
miguel-heygen merged 8 commits into
mainfrom
fix/studio-sealed-refused-press-box-back
Nov 24, 2026
Merged

miguel-heygen merged 8 commits into
mainfrom
fix/studio-sealed-refused-press-box-back

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

When a sealed preview answers neither of two presses in a row, Studio's selection box now goes back onto the layer. Before, it stayed where the first drag ended. It also goes back when the selection clears while the press waits.

Stacked on #8720 (base fix/studio-sealed-unanswered-press-refused). It retargets to main once #8720 merges, so main's Build and Studio gates run on it only then.

Why

#8720 refuses a press the frame never answers and draws Studio's box back to where that press found it. Its review found two cases where the box stays off the layer. Both happen only in a sealed preview:

  • Two presses in a row. A press made while another waits measures its box from the first press's drag. When both are refused, the second goes back to that dragged box, 150 px off the layer in the capture below. The file is unchanged.
  • Selection cleared mid-wait. The draw-back only ran with a selection to name in the message, so it was skipped and the box stayed where it was dragged.

Related work

Follows #8720. Refs #7846 (Studio's preview sealed by default).

How

components/editor/previewGestureStarts.ts:

  • Each waiting press knows how to draw the box back (drawBack). If the press before it was refused too, it defers to that press, so the box goes where the layer still is. If the press before it started, its own box is where that press dropped the layer.
  • A refused press is marked refused. The draw-back runs before the message, whether or not a selection is left. The message still needs one.

components/editor/domEditOverlayGestures.ts: the two fields on WaitingPressState.

Test plan

  • fails without the fix: in src/components/editor/previewOverlayRects.test.ts, puts the box back on the layer when two presses in a row go unanswered and puts the box back on the layer when the selection clears while an unanswered press waits both failed on fix(studio): a sealed drag the preview never answers is refused, not saved wrong #8720's code, with the box left at left: 31 instead of left: 1.
  • puts the box where a started press left it when the press after it goes unanswered: the first press starts, the second is refused, and the box stays where the first one dropped the layer.
  • Mutations on the devbox, each run against the file: always going back to the first press's box fails only the started-first test; never deferring fails only the two-presses test (1 failed, 31 passed each).
  • On the devbox: the file 3 runs, green. The 41 Studio test files that cover the changed files, green. tsc, Fallow and the pre-push hooks clean.
  • Real app: sealed Studio's dev server on the devbox, fixture box selected, every request from Studio to the frame dropped. Drag the box 150 px right and 60 px down, then 300 ms later press on the moved box and drag 100 px more. Both presses are refused with the toast and the file is unchanged in both builds. Only where the box ends up differs.

Before

#8720's code: the box is left where the first drag ended, off the layer.

#8720's code, two refused presses: Studio's box left off the layer where the first drag ended

After

This branch: the box is back on the layer.

This branch, two refused presses: the box back on the layer

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No code blocker at 6825e65. drawBack defers to the earlier press when it was refused and otherwise draws the press's own box, so the box returns to the layer after two refused presses, and also when the selection clears mid-wait (the draw-back now runs before the selection check; the message still needs one). The body names tests that fail without the fix and has before and after captures. This PR is stacked on #8720, so I am not approving yet: approve once retargeted to main after #8720 merges.

Base automatically changed from fix/studio-sealed-unanswered-press-refused to main November 24, 2026 19:18
…used-press-box-back

# Conflicts:
#	packages/studio/src/components/editor/previewGestureStarts.ts
#	packages/studio/src/components/editor/previewOverlayRects.test.ts

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base is main now, but the branch cannot merge as it stands: GitHub reports it conflicting with main (DIRTY). The head still carries #8720's five individual commits, and #8720 landed on main as one squash commit. Against main the diff therefore shows #8720's changes again, not only this PR's.

The content is already the same: the three studio files on main are byte-identical to #8720's last head. So a rebase onto main, or a merge of main, should leave only this PR's own two commits (3 files, about 70 changed lines), with no real conflict. No code blocker in that change; my earlier read stands. Push that and ping me, and I approve the new head once its checks are green.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 79 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 6f1d747. Base is main, the branch merges cleanly, and the diff against main is only this PR's own change: 3 studio files, about 70 changed lines. The new head is a merge of main; the three studio files are byte-identical to the 6825e65 I reviewed, so my earlier read stands with no code blocker. All checks are green on this head.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit b3da2cf Nov 24, 2026
80 checks passed
@miguel-heygen
miguel-heygen deleted the fix/studio-sealed-refused-press-box-back branch November 24, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants